import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceOperateLogVO, DeviceOperateLogForm, DeviceOperateLogQuery } from '@/api/device/deviceOperateLog/types';

/**
 * 查询用户操作记录列表
 * @param query
 * @returns {*}
 */

export const listDeviceOperateLog = (query?: DeviceOperateLogQuery): AxiosPromise<DeviceOperateLogVO[]> => {
  return request({
    url: '/device/deviceOperateLog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户操作记录详细
 * @param userOperateId
 */
export const getDeviceOperateLog = (userOperateId: string | number): AxiosPromise<DeviceOperateLogVO> => {
  return request({
    url: '/device/deviceOperateLog/' + userOperateId,
    method: 'get'
  });
};

/**
 * 新增用户操作记录
 * @param data
 */
export const addDeviceOperateLog = (data: DeviceOperateLogForm) => {
  return request({
    url: '/device/deviceOperateLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户操作记录
 * @param data
 */
export const updateDeviceOperateLog = (data: DeviceOperateLogForm) => {
  return request({
    url: '/device/deviceOperateLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户操作记录
 * @param userOperateId
 */
export const delDeviceOperateLog = (userOperateId: string | number | Array<string | number>) => {
  return request({
    url: '/device/deviceOperateLog/' + userOperateId,
    method: 'delete'
  });
};
